package com.atguigu.oss.controller;

import com.atguigu.commonutils.Response;
import com.atguigu.oss.service.OssService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Author zhaolie
 * @Date 2020/12/5 9:58 下午
 * @Version 1.0
 * @Description OSS控制器
 */

@RestController
@RequestMapping("/eduoss")
public class OssController {

    @Resource
    private OssService ossService;

    @PostMapping
    public Response uploadOssFile(MultipartFile file) {
        String url = ossService.uploadFileAvatar(file);
        return Response.SUCCESS().data("url", url);
    }
}
